package day04;

import java.util.ArrayList;
import java.util.Random;

public class Member extends User {
	public Member(){
	}
	public Member(String name,int money){
		super(name,money);
	}
	//收红包
	public void receive(ArrayList<Integer> list){
		if(list.size()>0){
			//从随机集合中获取的编号
			int index = new Random().nextInt(list.size());
			//根据索引 ,从集合当中移出
			Integer delta = list.remove(index);
			//给成员加上去
			super.setMoney(delta+super.getMoney());
		}

	}
}
